<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/javascript.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml" id="teacherForm">
<head>
    <title>课程管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="${ctx}/static/thecodemine-formwizard/css/ui-lightness/jquery-ui-1.8.2.custom.css" />  
    <script type="text/javascript" src="${ctx}/static/thecodemine-formwizard/js/bbq.js"></script>
    <script type="text/javascript" src="${ctx}/static/thecodemine-formwizard/js/jquery-ui-1.8.5.custom.min.js"></script>
    <script type="text/javascript" src="${ctx}/static/thecodemine-formwizard/js/jquery.form.wizard.js"></script> 
    <style>
        #navigation { 
            float: right;
            text-align: right;
        }
        
        .navigation_button {
            width: 70px;
            height: 24px;
            margin: 0 5px;
        }
    </style>
    
    <script type="text/javascript">  
	var mainform;
	
    $(function (){  
		//$("#aim").ligerTextBox({width: 400});
		//$("#keynote").ligerTextBox({width: 400});
		//$("#aidIntro").ligerTextBox({width: 400});
		//$("#hwkh_file").ligerTextBox({width: 400});
		$("#cancel").bind('click', function() {
			 window.parent.dialog.close();	
		});
		
		$("#materiald").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true, width: 400, labelWidth:400,
			initValue: '${materialdValue}', 
            data:[
				<c:forEach items="${materialdList}" var="materiald" varStatus="status">
					{ text: '${materiald.title}', id: '${materiald.id}'}${!status.last ? ',' : ''}
				</c:forEach> 
            ], valueFieldID: 'materialdValue'
        }); 		
		
		mainform=$("#mainform");        
        mainform.ligerForm();
		
		$.metadata.setType("attr", "validate");
        LG.validate(mainform);
		 
    	$(mainform).formwizard({
    		textSubmit: '完成',
    		textNext: '下一步',
    		textBack: '上一步',
    		validationEnabled: true,
		 	formPluginEnabled: true, 
		 	focusFirstInput : true,
		 	formOptions :{		 		 		 		
				success: function(result){ 
                    if(typeof(result)=="string"){
                        result=eval("("+result+")");
                    }
                    if (!result.success) {
                        LG.showError('错误:' + data.message);
                    }
                    else { 
                    	$("#mainform").hide();
                        LG.showSuccess('保存成功', function () { 
                           window.parent.refresh();
                           window.parent.dialog.close();
                        });
                    }
                },
// 				data: { id: '$("#btableId").val()', aim: '$("#aim").val()', keynote: '$("#keynote").val()', 
// 						materialdValue: '$("#materialdValue").val()', aidIntro: '$("#aidIntro").val()', hwkh: '$("#hwkh").val()' }, 
				resetForm: true
		 	}	
		 });

    	
    	 $('#aidFileUpload').uploadify({
    		formData : {
    			"jsessionid": "<%=request.getSession().getId()%>"
			}, 
   	        swf      : '${ctx}/static/uploadify/uploadify.swf',
   	        uploader : '${ctx}/qso/btable/manage/aid/upload',
   	        width: 100,
   			height:22,
   			auto: false,
   			fileObjName: 'attachment',
   			fileTypeExts: '*.jpg;*.gif;*.png;*.bmp;*.doc;*.docx;*.xls;*.xlsx;*.ppt;*.pptx;*.txt;*.rar;*.zip;',
   			fileSizeLimit: 20971520,
   			checkExisting: true,
   			method: 'post',  
   			removeCompleted : false,
   			buttonText:'浏览',
   			queueSizeLimit: 5,
   			displayData: 'percentage',
   			queueID:'aid-queue',
   			cancelImg: '${ctx}/static/uploadify/uploadify-cancel.png', 
   			onUploadSuccess : function(file, data, response){
   				 //$("#aid-info").append("文件" + file.name + "上传成功！<br/>");
   			},
   			onQueueComplete: function() {
   				 //$("#aid-info").append("文件全部上传成功！<br/>"); 
   			},
   			onUploadError : function(file, errorCode, errorMsg){
   				 if(errorCode == -200){
   					 $("#aid-info").append("文件" + file.name + "大小超过最大限制20M！<br/>");
   				 }
   				 //$("#aid-info").append("文件" + file.name + "上传失败！<br/>");
   			}
   	    });
    	 
    	$('#aidStart').bind('click', function() {
    		$('#aidFileUpload').uploadify('upload','*');
    	});
    	
    	$('#homeworkFileUpload').uploadify({
    		formData : {
    			"jsessionid": "<%=request.getSession().getId()%>"
			}, 
   	        swf      : '${ctx}/static/uploadify/uploadify.swf',
   	        uploader : '${ctx}/qso/btable/manage/homework/upload',
   	        width: 100,
   			height:22,
   			auto: false,
   			fileObjName: 'attachment',
   			fileTypeExts: '*.jpg;*.gif;*.png;*.bmp;*.doc;*.docx;*.xls;*.xlsx;*.ppt;*.pptx;*.txt;*.rar;*.zip;',
   			fileSizeLimit: 20971520,
   			checkExisting: true,
   			method: 'post',  
   			removeCompleted : false,
   			buttonText:'浏览',
   			queueSizeLimit: 5,
   			displayData: 'percentage',
   			queueID:'homework-queue',
   			cancelImg: '${ctx}/static/uploadify/uploadify-cancel.png', 
   			onUploadSuccess : function(file, data, response){
   				 //$("#homework-info").append("文件" + file.name + "上传成功！<br/>");
   			},
   			onQueueComplete: function() {
   				 //$("#homework-info").append("文件全部上传成功！<br/>"); 
   			},
   			onUploadError : function(file, errorCode, errorMsg){
   				 if(errorCode == -200){
   					 $("#homework-info").append("文件" + file.name + "大小超过最大限制20M！<br/>");
   				 }
   				 //$("#homework-info").append("文件" + file.name + "上传失败！<br/>");
   			}
   	    });
    	 
    	$('#homeworkStart').bind('click', function() {
    		$('#homeworkFileUpload').uploadify('upload','*');
    	});
    	
    	$(".l-text-combobox").css('width', '400px');
    	$("#materiald").css('width', '380px');
    });
    
 </script>
</head>

<body>
	<form name="mainform" method="post" id="mainform" action="${ctx}/qso/btable/manage/save" class="bbq"> 
		<input type="hidden" id="btableId" name="btableId" value="${command.id}" />
		<input type="hidden" id="aidId" name="aidId" value="${aidId}" />
		<input type="hidden" id="hwkhId" name="hwkhId" value="${hwkhId}" />
		<div id="fieldWrapper" style="height:300px;">
			<div class="step" id="first">
				<table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 95%; margin-top:10px; margin-left:15px;">
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">课程名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.couid.title}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">科系：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.dptid.title}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">教室名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.crmid.crmTitle}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">年级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.gradeid.gradeTitle}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">班级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.claid.clsTitle}</td>
						<td align="left"></td>
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top">教学目的：</td>
						<td align="left" class="l-table-edit-td" colspan="3">
							<textarea cols="100" rows="5" class="l-textarea" validate="{required:true}" id="aim" name="aim" style="height: 60px; width: 80%;">${aim}</textarea>
						</td>
					</tr> 
					<tr>
						<td align="right" class="l-table-edit-td" valign="top">教学重点：</td>
						<td align="left" class="l-table-edit-td" colspan="3">
							<textarea cols="100" rows="5" class="l-textarea" validate="{required:true}" id="keynote" name="keynote" style="height: 60px; width: 80%;">${keynote}</textarea>
						</td>						
					</tr>
				</table>
			</div>
		
			<div id="second" class="step" style="display:none;">
				<table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 90%; margin-top:10px; margin-left:15px;">
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">课程名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.couid.title}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">科系：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.dptid.title}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">教室名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.crmid.crmTitle}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">年级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.gradeid.gradeTitle}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">班级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.claid.clsTitle}</td>
						<td align="left"></td>
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">选择教材：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;"><input type="text" id="materiald"/></td>	
						<td align="left"></td>					
					</tr>
				</table>					
			</div>
			
			<div id="third" class="step" style="display:none;">
				<table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 90%; margin-top:10px; margin-left:15px;">
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">课程名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.couid.title}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">科系：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.dptid.title}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">教室名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.crmid.crmTitle}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">年级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.gradeid.gradeTitle}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">班级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.claid.clsTitle}</td>
						<td align="left"></td>
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top">课件说明：</td>
						<td align="left" class="l-table-edit-td" colspan="9"><input id="aidIntro" name="aidIntro" type="text" value="${aidIntro}" validate="{required:true}" ltype="text"/><label for="aidIntro" /><td>						
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top">课件附件：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">
							<input type="file" id="aidFileUpload" name="aidFileUpload" ></input>
                			<div id="aid-queue"></div>
                			<div id="aid-info"></div>
                			<div id="btnCon">
      	  						<input type="button" id="aidStart" name="aidStart" value="开始上传" style="margin-left:auto;margin-right: auto;"/>
      	  					</div>
						</td>						
					</tr>
				</table>
			</div>
			
			<div id="fourth" class="step" style="display:none;">
				<table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 90%; margin-top:10px; margin-left:15px;">
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">课程名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.couid.title}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">科系：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.dptid.title}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">教室名称：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.crmid.crmTitle}</td>
						
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">年级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.gradeid.gradeTitle}</td> 
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top" style="width:15%;">班级：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">${command.claid.clsTitle}</td>
						<td align="left"></td>
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top">布置作业：</td>
						<td align="left" class="l-table-edit-td" colspan="9"><input id="hwkh" name="hwkh" type="text" value="${hwkh}" validate="{required:true}" ltype="text"/><label for="hwkh" /></td>						
					</tr>
					<tr>
						<td align="right" class="l-table-edit-td" valign="top">作业附件：</td>
						<td align="left" class="l-table-edit-td" style="width:35%;">
                			<input type="file" id="homeworkFileUpload" name="homeworkFileUpload" > </input>
                			<div id="homework-queue"></div>
                			<div id="homework-info"></div>
                			<div id="btnCon">
      	  						<input type="button" id="homeworkStart" name="homeworkStart" value="开始上传" style="margin-left:auto;margin-right: auto;"/>
      	  					</div>
						</td>						
					</tr>
				</table>
			</div>
		</div>
		
		<div id="navigation">
			<input class="navigation_button" id="back" value="上一步" type="reset" /> 							 
			<input class="navigation_button" id="next" value="下一步" type="submit" />
            <input class="navigation_button" id="cancel" value="取消" type="button" />
		</div> 
	</form> 
</body>
</html>
